package main

import "fmt"

func main() {
	for i := 10; i <= 1; i-- {
		fmt.Println(i)
	}
	var s = 0
	for ; s < 10; s++ {
		fmt.Println(s)
	}

	for s > 100 {
		s++
		break
		continue
	}

	switch s {
	case 10:
		break
	case 11, 12, 13:
		break
	}

	// goto

}

const repeatCount = 5

// 使一个字符串重复几次
func Repeat(character string) string {
	var repeated string
	for i := 0; i < repeatCount; i++ {
		repeated += character
	}
	return repeated
}

// 计算一个数组的和
func Repeat2() int {
	var repeated int
	arr := [...]int{1, 2, 3, 34}
	// range 迭代 index,value
	for _, value := range arr {
		repeated += value
	}
	return repeated
}

// 条件 循环
func Repeat3(max int) int {
	i := 1
	for i <= max {
		fmt.Println(i)
		i = i + 1
	}
	return i
}

// 循环的 break 和 continue
